package com.springmvc.controller;

import com.springmvc.entity.Goods;
import com.springmvc.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/*@Controller
@ResponseBody*/
//@RestController相当于@Controller+@ResponseBody
@RestController
public class CombineController {

    //@RequestMapping(value = "/goods",method = RequestMethod.GET)
    @GetMapping(value = "/goods")
    public Goods goods(){
        return new Goods(100L,"苹果手机");
    }

    //@RequestMapping(value = "/user",method = RequestMethod.GET)
    @GetMapping("/user")
    public User user(){
        return new User(1L,"张三");
    }

    @PostMapping("/user/save")
    public User save(String userName){
        return new User(1L,userName);
    }

}
